/// 用户内容查询请求模型
class UserContentRequest {
  final int userId;
  final int? days;
  final int timestamp;

  UserContentRequest({
    required this.userId,
    this.days,
    int? timestamp,
  }) : timestamp = timestamp ?? DateTime.now().millisecondsSinceEpoch ~/ 1000;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> json = {
      'userId': userId.toString(),
      'timestamp': timestamp,
    };
    
    // 🔥 修复：与MyApplication2保持一致，当days为null时也要显式添加到JSON中
    json['days'] = days; // 允许null值传递，与MyApplication2的格式完全一致
    
    return json;
  }
}
